import type { FormField, FormFieldConfig } from '@/types/form'

export const getFormFields = (
  fieldConfigs: Record<string, FormFieldConfig>,
  fields?: string[]
): Record<string, FormFieldConfig> => {
  const selectedFields = fields || Object.keys(fieldConfigs)
  return selectedFields.reduce((acc, field) => {
    acc[field] = fieldConfigs[field]
    return acc
  }, {} as Record<string, FormFieldConfig>)
}
